Developer --> Technical Publications
PATHHardware Documentation > USB Devices > Mac OS USB DDK API Reference


USBAllocMem

The USBAllocMem function allocates a specified amount of memory.

OSStatus USBAllocMem(USBPB *pb);

Required fields in the USBPB parameter block for the USBAllocMem function are

--> pbLength
Length of parameter block
--> pbVersion
Parameter block version number
--> usbCompletion
The completion routine
--> usbRefcon
General-purpose value passed back to the completion routine
--> usbReference
A device, interface, or pipe reference which associates the call with a device
--> usbReqCount
Amount of memory required to be allocated
<-- usbActCount
Amount of memory actually allocated
<-- usbBuffer
Memory allocated
--> usbFlags
Should be set to 0

There must be a valid USBReference passed in the usbReference field of the parameter block. If a nil value or a reference that does not match an existing device, interface, or pipe is passed in, the call returns immediately with an unknown device error.

If the device associated with this call is unplugged and its driver removed while this function call is pending, the function will not complete. In this case, your finalize routine can assume that it is safe to dispose of the parameter block for this call.

The USBAllocMem function returns the following error:

kUSBUnknownDeviceErr
-6998 usbReference does not refer to a current device

© 1999 Apple Computer, Inc.

Previous | Back Up One Level | Next | Show Frames | Hide Frames